FROM node:16.17.0
# 创建工作目录
RUN mkdir -p /service
WORKDIR /service

# 复制应用程序
ADD ./ /service

# 修改权限
RUN chmod 755 /service

# 安装依赖
WORKDIR /service

ENV NODE_ENV=production
# RUN npm config set registry http://registry.npmmirror.com
# RUN npm install -g npm@9.6.5
RUN npm install
# 数据库迁移
RUN npm install sequelize-cli -g

# 暴露端口
EXPOSE 9000


CMD sh -c 'npm run db:migrate && npm run start:docker'



